import sys
import unittest

sys.path.append("..")

from xithyl.tests import FirstTest
from xithyl import logger


class BasicTests(unittest.TestCase):

    def test_Passed(self):
        self.assertTrue(FirstTest.Start(True), FirstTest.error)

    def test_Failed(self):
        res = FirstTest.Start(False)
        msg = FirstTest.ErrorMsg()
        self.assertTrue(res, msg)

if __name__ == '__main__':
    test = BasicTests
    suite = unittest.TestLoader().loadTestsFromTestCase(test)

    # Open logger
    f = open("/tmp/xithyl.log", "a")
    logger.outs.append(f)
    logger.start()

    unittest.TextTestRunner(verbosity=2).run(suite)

    logger.stop()

